package com.example.exam.utils;
public class DateUtil {

	public static int getMs(long endTime,long startTime) {
        long between = 0;
        try {
            between = (endTime - startTime);// 得到两者的毫秒数
        } catch (Exception ex) {
            ex.printStackTrace();
            return 0;
        }
        long day = between / (24 * 60 * 60 * 1000);
        long hour = (between / (60 * 60 * 1000) - day * 24);
        long min = ((between / (60 * 1000)) - day * 24 * 60 - hour * 60);
        long s = (between / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
        long ms = (between - day * 24 * 60 * 60 * 1000 - hour * 60 * 60 * 1000 - min * 60 * 1000 - s * 1000);
        return (int)ms;
	} 
}
